/**
 *<p>Copyright: CHINA NATIONAL SOFTWARE & Manager CO.,LTD.</p>
 */
package com.cssnb.wwxt.kkcx.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cssnb.commons.utils.CharsetUtils;
import com.cssnb.commons.utils.ParameterMap;
import com.cssnb.commons.utils.page.PageUtils;
import com.cssnb.wwxt.kkcx.service.KkcxManager;

/**
 * @Company: 中国软件与技术服务股份有限公司宁波子公司
 * @Project: 宁波市国税-外维系统
 * @Module ID:
 * @Description:
 * @JDK version used: JDK1.6
 * @Author: 卜繁晟
 * @Email: 5545795@qq.com | bufsh@css.com.cn
 * @Created Date: 2013-4-19 下午4:57:35
 */
@Controller
@RequestMapping("/kkcx")
@SuppressWarnings({ "unused", "unchecked", "rawtypes" })
public class KkcxController {

	@Autowired
	KkcxManager kkcxManager;

	@RequestMapping({ "/index", "/", "" })
	public String index(HttpServletRequest request, HttpServletResponse response){
		Map pMap = ParameterMap.getParameterMap(request);
		int nsrCount = kkcxManager.getNsrCount(pMap);
		pMap.putAll(PageUtils.getPageInfo(request, nsrCount));
		List nsrList = kkcxManager.getNsrList(pMap);
		request.setAttribute("nsrList", CharsetUtils.getEncodingList(nsrList, "iso-8859-1", "GBK"));
		return "kkcx/list";
	}
	@RequestMapping("/search")
	public String search(HttpServletRequest request, HttpServletResponse response){
		Map pMap = ParameterMap.getParameterMap(request);
		int kkcxCount = kkcxManager.getKkcxCount(pMap);
		List kkcxList = kkcxManager.getKkcxList(pMap);
		request.setAttribute("kkcxList", CharsetUtils.getEncodingList(kkcxList, "iso-8859-1", "GBK"));
		return "kkcx/search";
	}
	@RequestMapping("/form")
	public String form(HttpServletRequest request, HttpServletResponse response){
		Map pMap = ParameterMap.getParameterMap(request);
		Map kkcxInfo = kkcxManager.getKkcx(pMap);
		request.setAttribute("kkcx", CharsetUtils.getEncodingMap(kkcxInfo, "iso-8859-1", "GBK"));
		return "kkcx/form";
	}
}